// https://org.modao.cc/app/277ce50586e8e01a98eeca6e44fab196#screen=sADF20F34611557385791584
//https://org.modao.cc/app/9fe2d9f671ae73d5894aca6dd2bc1b9b#screen=s151B772E0A1557636578154
import request from '@/router/axios';
export const getUserData = (page) => request({
    url: '/admin/getUser',
    method: 'get',
    data: {
        page
    }
})

export const getRoleData = (data) => request({
    url: '/role/list',
    method: 'post',
    data
})

export const updateRoleData = (data) => request({
    url: '/role/update',
    method: 'post',
    data
});
export function removeRoleById(Id) {
    return request({
        url: '/role/delete',
        method: "post",
        data: {
            Id
        }
    })
}
export function removeRoleByIds(Ids) {
    return request({
        url: '/role/delete-by-ids',
        method: "post",
        data: {
            Ids
        }
    })
}

export const createRoleData = (data) => request({
    url: '/role/create',
    method: "post",
    data
})


export const getDic = (type) => request({
    url: '/admin/getDic',
    method: 'get',
    data: {
        type
    }
})


export function listAllRoles(data) {
    return request({
        url: '/admin/list-all',
        method: 'post',
        data
    });
}

export const list = (data) => request({
    url: '/admin/list',
    method: 'post',
    data
});
export const create = (data) => request({
    url: '/admin/create',
    method: "post",
    data
});
export const update = (data) => request({
    url: '/admin/update',
    method: "post",
    data
});
export const remove = (Id) => request({
    url: '/admin/delete',
    method: "post",
    data: {
        Id
    }
});

export function allCaptain() {
    return request.get('/admin/all-captain');
}

export function queryRoleCodeList(roleId) {
    return request.get('/role/code-list?roleId=' + roleId);
}

export function saveRoleCodeList(roleId, codeList) {
    return request.post('/role/save-code-list', {
        roleId,
        codeList
    });
}

export function queryCodeListOfCurrentUser() {
    return request.post('/role/code-list-of-current-user');
}

export function resetPwd(id) {
    return request.get('/admin/reset-pwd?id=' + id)
}

export function setOffline(id) {
    return request.get('/admin/set-offline?id=' + id)
}
export function setOnline(id) {
    return request.get('/admin/set-online?id=' + id)
}

export function updateAdminInfo(param) {
    return request.post('/admin/update-admin-info', param);
}

export function updatePwd(param) {
    return request.post('/admin/update-pwd', param);
}
